package com.tpshion.cloud.core.support;

/**
 * 保存当前线程中的session对象
 */
public class SessionHolder {
    private static ThreadLocal<Session> CURRENT_SESSION = new ThreadLocal<>();

    public static Session get(){
        return CURRENT_SESSION.get();
    }

    public static void set(Session session){
        CURRENT_SESSION.set(session);
    }

    public static void remove(){
        if (CURRENT_SESSION.get() != null){
            CURRENT_SESSION.remove();
        }
    }
}
